#include<bits/stdc++.h>

using namespace std;

int main() {
    srand(time(0));//1970-1-1 0:0:0
    int N = 1000000;
    int M = 0;
    for (int i = 0; i < N; i++) {
        double x = rand() * 1.0 / RAND_MAX;
        double y = rand() * 1.0 / RAND_MAX;
        //check P(x,y) is in Circle ornot?
        double op = sqrt(x * x + y * y);
        if (op <= 1) {
            M++;
        }
    }
    //cout<<M<<endl;
    double pi = 4.0 * M / N;

    cout << pi << endl;

    return 0;
}
